function main()
{
	var templateNodeRef = args.templateNodeRef;
	var templateFile = search.findNode(templateNodeRef);
	
	var targetFolder={};
	
	if (args.targetNodeRef) {
		// call service with nodeRef param
		targetFolder = search.findNode(args.targetNodeRef);
	}else{
		// call service with path param
		var path = args.copyDir;
		var docLibNode = companyhome.childByNamePath("/Sites/epdk/documentLibrary")
		
		if (path == "root") {
			// target is doclib
			targetFolder = docLibNode;
		} else {
			targetFolder = docLibNode.childByNamePath(path);
		}
	}
	
	
	var copyFile = templateFile.copy(targetFolder);
	
	copyFile.addAspect("epdk:sablondan");
	
	var responseObject = {};
	responseObject.nodeRef = copyFile.nodeRef;
	
	var jsonString = jsonUtils.toJSONString(responseObject);
	model.jsonString = jsonString;
	
}

main();